package cloudspace.ui.applet;

import java.io.IOException;

import cloudspace.ui.applet.util.BASE64Decoder;
import cloudspace.ui.applet.util.BASE64Encoder;


public abstract class BASE64
{
    public static String encodeContent( byte[] b )
    {
        BASE64Encoder encode = new BASE64Encoder();
        String encoded = encode.encode( b );
        return encoded;
    }


    public static void decodeContent(
        String content,
        byte[] b,
        int off,
        int length )
    {
        BASE64Decoder decode = new BASE64Decoder();
        byte[] decoded = null;
        try
        {
            decoded = decode.decodeBuffer( content );
        }
        catch ( IOException e )
        {
            e.printStackTrace();
        }
        System.arraycopy( decoded, 0, b, off, length );
    }
}
